package com.rrd.dw.yarn.job.history;

import java.io.File;
import java.io.IOException;

import org.apache.avro.file.DataFileReader;
import org.apache.avro.io.DatumReader;
import org.apache.avro.specific.SpecificDatumReader;
import org.apache.hadoop.mapreduce.jobhistory.JobFinished;

/**
*
*@author liubaoxin
*@date 2020年4月2日
*/
public class JobHistoryParse {

	private static void parseJob() throws IOException{
		DatumReader<JobFinished> reader = new SpecificDatumReader<JobFinished>(JobFinished.class);
		 DataFileReader<JobFinished> dataFileReader = new DataFileReader<JobFinished>(new File("D:\\aa\\avo\\file.jhist"), reader);
		 JobFinished jobFinish = null;
		 while (dataFileReader.hasNext()) {
			 jobFinish = dataFileReader.next();
	            System.out.println(jobFinish);
	       }      
	}
	public static void main(String[] args) {
		try {
			parseJob();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
